import requests
import execjs


with open(r'E:\Python\vscode\Crawlers\yuanrenxue\no2\cookie_b.js', 'r', encoding='utf-8') as f:
    js = execjs.compile(f.read())
m_sign = js.call('_0x582a1d')
cookies = {
    'sessionid': 'tj8xzy9mva0lrap63c1iismgeju85kyc',
    'no-alert3': 'true',
    'tk': '-3926317673094070268',
    'Hm_lvt_434c501fe98c1a8ec74b813751d4e3e3': '1753250724',
    'Hm_lpvt_434c501fe98c1a8ec74b813751d4e3e3': '1753250724',
    'HMACCOUNT': '960263B4D96B0969',
    'm': m_sign,
}

headers = {

    'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36'
}
list_h = []
for i in range(5):
    params = {
        'page' : f'{i + 1}'
    }
    response = requests.get('https://match.yuanrenxue.cn/api/match/2', headers=headers, cookies=cookies,params=params)
    hot_value = response.json()['data']
    list_h += [b['value'] for b in hot_value]
hot_ave = sum(list_h)
print(hot_ave)
